home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1997 / HAM Radio 1997.iso / vcls / moden / tcom / flowparm.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-04-08  |  2.4 KB  |  98 lines

  1. {$G+,X+}
  2.  
  3. {Conditional defines that may affect this unit}
  4. {$I AWDEFINE.INC}
  5.  
  6. {*********************************************************}
  7. {*                  FLOWPARM.PAS 1.01                    *}
  8. {*        Copyright (c) TurboPower Software 1995         *}
  9. {*                 All rights reserved.                  *}
  10. {*********************************************************}
  11.  
  12. unit Flowparm;
  13.  
  14. interface
  15.  
  16. uses
  17.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  18.   Forms, Dialogs, StdCtrls, ExtCtrls, Buttons, AdPort, TComIni;
  19.  
  20. type
  21.   TFlowControlForm = class(TForm)
  22.     HardwareFlowGroup: TRadioGroup;
  23.     SoftwareFlowGroup: TGroupBox;
  24.     ReceiveFlowBox: TCheckBox;
  25.     TransmitFlowBox: TCheckBox;
  26.     Label1: TLabel;
  27.     Label2: TLabel;
  28.     XonCharEdit: TEdit;
  29.     XoffCharEdit: TEdit;
  30.     OkBtn: TBitBtn;
  31.     CancelBtn: TBitBtn;
  32.     HelpBtn: TBitBtn;
  33.     procedure OkBtnClick(Sender: TObject);
  34.  
  35.   public
  36.     constructor Create(AOwner : TComponent); override;
  37.   end;
  38.  
  39. implementation
  40.  
  41. {$R *.DFM}
  42.  
  43. constructor TFlowControlForm.Create(AOwner : TComponent);
  44. begin
  45.   inherited Create(AOwner);
  46.  
  47.   {set default values}
  48.   if (hwfUseRTS in HdwFlow) or (hwfRequireCTS in HdwFlow) then
  49.     HardwareFlowGroup.ItemIndex := 2
  50.   else if (hwfUseDTR in HdwFlow) or (hwfRequireDSR in HdwFlow) then
  51.     HardwareFlowGroup.ItemIndex := 1
  52.   else
  53.     HardwareFlowGroup.ItemIndex := 0;
  54.  
  55.   case SfwFlow of
  56.     swfReceive : ReceiveFlowBox.Checked  := True;
  57.     swfTransmit: TransmitFlowBox.Checked := True;
  58.     swfBoth    :
  59.       begin
  60.         ReceiveFlowBox.Checked  := True;
  61.         TransmitFlowBox.Checked := True;
  62.       end;
  63.   end;
  64.  
  65.   XonCharEdit.Text  := IntToStr(Ord(XonChar));
  66.   XoffCharEdit.Text := IntToStr(ord(XoffChar));
  67. end;
  68.  
  69. procedure TFlowControlForm.OkBtnClick(Sender: TObject);
  70. var
  71.   E    : Integer;
  72.   Temp : Byte;
  73.  
  74. begin
  75.   case HardwareFlowGroup.ItemIndex of
  76.     0: HdwFlow := [];
  77.     1: HdwFlow := [hwfUseDTR, hwfRequireDSR];
  78.     2: HdwFlow := [hwfUseRTS, hwfRequireCTS];
  79.   end;
  80.  
  81.   if TransmitFlowBox.Checked and ReceiveFlowBox.Checked then
  82.     SfwFlow := swfBoth
  83.   else if TransmitFlowBox.Checked then
  84.     SfwFlow := swfTransmit
  85.   else if ReceiveFlowBox.Checked then
  86.     SfwFlow := swfReceive;
  87.  
  88.   Val(XonCharEdit.Text, Temp, E);
  89.   if (E = 0) then
  90.     XonChar := Char(Temp);
  91.   Val(XoffCharEdit.Text, Temp, E);
  92.   if (E = 0) then
  93.     XoffChar := Char(Temp);
  94. end;
  95.  
  96. end.
  97.  
  98.